﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;

namespace F2S.LINQ2LinkedIn.Client.Storage
{
    public class StorageManager : IStorageManager
    {
        private ApplicationDataContainer _roamingSettings;

        public StorageManager()
        {
            _roamingSettings = ApplicationData.Current.RoamingSettings;

        }

        public string LoadData(object forThisObject)
        {
            var key = forThisObject.GetType().Name;
            return _roamingSettings.Values.ContainsKey(key) ? _roamingSettings.Values[key].ToString() : string.Empty;
        }

        public void SaveData(object forThisObject, string jsonData)
        {
            _roamingSettings.Values[forThisObject.GetType().Name] = jsonData;
        }
    }
}
